/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sistemperpustakaan.tablemodel;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import sistemperpustakaan.entity.HariLibur;

/**
 *
 * @author EKo
 */
public class HariLiburTableModel extends AbstractTableModel {

    List<HariLibur> listHariLibur;
    String[] header = {"Tanggal", "Keterangan"};

    public HariLiburTableModel() {
        listHariLibur = new ArrayList<HariLibur>();
    }

    public HariLiburTableModel(List<HariLibur> listHariLibur) {
        this.listHariLibur = listHariLibur;
    }

    public List<HariLibur> getListHariLibur() {
        return listHariLibur;
    }

    public void setListHariLibur(List<HariLibur> listHariLibur) {
        this.listHariLibur = listHariLibur;
    }

    public int getRowCount() {
        return listHariLibur.size();
    }

    public int getColumnCount() {
        return 2;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        return listHariLibur.get(rowIndex).getObject(columnIndex);
    }

    @Override
    public String getColumnName(int column) {
        return header[column];
    }
}
